package util;

import java.util.ArrayList;

public class PageHelper<T> {

    /*
    记录数据的总条数
     */
    private Integer totalData;


    /*
    记录数据的总页数
     */
    private Integer totalPage;

    /*
    每页显示多少条数据
     */
    private Integer showData = 2;

    /*
    记录当前是第几页
     */
    private Integer indexPage = 1;

    /*
    记录当前页面，显示的数据集合
     */
    private ArrayList<T> list;


    public PageHelper() {
    }


    public PageHelper(Integer totalData, Integer totalPage, Integer showData, Integer indexPage, ArrayList<T> list) {
        this.totalData = totalData;
        this.totalPage = totalPage;
        this.showData = showData;
        this.indexPage = indexPage;
        this.list = list;
    }

    public Integer getTotalData() {
        return totalData;
    }

    public void setTotalData(Integer totalData) {
        this.totalData = totalData;
        totalPage = this.totalData%this.showData ==0?
                this.totalData/this.showData:
                this.totalData/this.showData+1;



    }

    public Integer getTotalPage() {
        return totalPage;
    }

    /*public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

     */

    public Integer getShowData() {
        return showData;
    }

    public void setShowData(Integer showData) {
        this.showData = showData;
    }

    public Integer getIndexPage() {
        return indexPage;
    }

    public void setIndexPage(Integer indexPage) {
        this.indexPage = indexPage;
    }

    public ArrayList<T> getList() {
        return list;
    }

    public void setList(ArrayList<T> list) {
        this.list = list;
    }
}
